﻿namespace LiteBlog.Infrastructure.Constraints
{
    using System.Web;
    using System.Web.Routing;

    public class CategoryConstraint : IRouteConstraint
    {
        public bool Match(
            HttpContextBase httpContext,
            Route route,
            string parameterName,
            RouteValueDictionary values,
            RouteDirection routeDirection)
        {
            if (parameterName == "id")
            {
                string id = values["id"].ToString();
                return (id.ToLower() == "admin") ? false : true;
            }

            return true;
        }
    }
}